<?php 
	$url["40"] = "http://182.138.27.40:8086/tvkc/index/hdvod.do?userid=123&backurl=test";
	$url["34"] = "http://182.138.27.34:8086/tvkc/index/hdvod.do?userid=123&backurl=test";
	//$url="http://182.138.27.40:8086/tvkc1/biz/biz_48622910.do?entry=hdvod&rememberHistory=true&leaveFocusId=m34290";
	// create a new cURL resource
	$body="";
	foreach ($url as $key => $value) {
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $value);
		//curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:8.8.8.'.$i, 'CLIENT-IP:8.8.8.'.$i));  //构造IP
		//curl_setopt($ch, CURLOPT_REFERER, "http://www.baidu.com");   //构造来路
		curl_setopt($ch, CURLOPT_HEADER, 1);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
		$out = curl_exec($ch);
		$monitor=curl_getinfo($ch);
		if($monitor['http_code']!=200||$monitor['http_code']!=302||$monitor['connect_time']>2||$monitor['pretransfer_time']>2){
			$body.=$key.":<br/>http_code:".$monitor['http_code']."<br>connect_time:".$monitor['connect_time']."<br>pretransfer_time:".$monitor['pretransfer_time']."<br><br><br>";
		}
		curl_close($ch);
	}
	if(""!=$body){
		require("class.phpmailer.php");
		$mail = new PHPMailer();    
        $mail->IsSMTP();                  // send via SMTP    
        $mail->Host = "smtp.126.com";   // SMTP servers    
        $mail->SMTPAuth = true;           // turn on SMTP authentication    
        $mail->Username = "tvkc_monitor";     // SMTP username  注意：普通邮件认证不需要加 @域名    
        $mail->Password = "tvkc_admin"; // SMTP password    
        $mail->From = "tvkc_monitor@126.com";      // 发件人邮箱    
        $mail->FromName =  "EPG监控员";  // 发件人    

        $mail->CharSet = "utf8";   // 这里指定字符集！    
        $mail->Encoding = "base64";    
        $mail->AddAddress("441965@qq.com",$user_name);  // 收件人邮箱和姓名    
        //$mail->AddReplyTo("yourmail@yourdomain.com","yourdomain.com");    
        //$mail->WordWrap = 50; // set word wrap 换行字数    
        //$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment 附件    
        //$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    
        $mail->IsHTML(true);  // send as HTML    
        // 邮件主题    
        $mail->Subject = "EPG出现问题";    
        // 邮件内容    
        $mail->Body = $body;
        $mail->AltBody ="text/html";    
        if(!$mail->Send())    
        {    
            echo "邮件发送有误 <p>";    
            echo "邮件错误信息: " . $mail->ErrorInfo;    
            exit;    
        }    
        else {    
            //echo "$user_name 邮件发送成功!<br />";    
        } 
    }

?>